package cn.wolfcode.wolf2w.util;

import cn.wolfcode.wolf2w.exception.LogicException;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

import javax.security.auth.login.LoginException;

import static org.springframework.util.Assert.hasLength;

public class AssertUtil {
    //判断参数是否为空，并报出异常信息
    public static void isEmpty(String value,String message){
        if(!StringUtils.hasLength(value)){
            throw new LogicException(message);
        }
    }
    //判断2次密码是否输入正确,并抛出异常信息
    public static void isEquals(String password,String repassword,String message){
        if(password==null||repassword==null){
            throw new LogicException("您输入的密码和重新输入密码不能为空");
        }
        if(!password.equals(repassword)){
            throw new LogicException(message);
        }
    }
}
